<?php include '../base/header.php' ?>
<?php
require_once '../sql/connection.php';
$commodity_id = $_GET['com_id'];
// 查询商品
$sql_config = "select * from commodity WHERE ID = $commodity_id";
// 连接数据库，并查询
$result_config = mysqli_query($GLOBALS['conn'], $sql_config);
// 获取商品信息
$row = mysqli_fetch_array($result_config);

// 查询所属系列
$sql_config = "select * from series WHERE ID = $row[5]";
// 连接数据库，并查询
$result_config = mysqli_query($GLOBALS['conn'], $sql_config);
// 获取商品所属系列
$m_series = mysqli_fetch_array($result_config);

?>

<!-- 商品基本信息 -->
<div class="uk-card uk-card-default uk-grid-collapse uk-child-width-1-2@s uk-margin" uk-grid>
    <div class="uk-card-media-left uk-cover-container">
        <img src="<?php echo $row[6] ?>001.jpg" alt="" uk-cover>
    </div>
    <div>
        <div class="uk-card-body">
            <h3 class="uk-card-title">
                <?php echo $row[1] ?>
                <a href='/page/public/list.php?id=<?php echo $m_series[0] ?>'>【<?php echo $m_series[1] ?>】</a>
            </h3>
            <pre><?php echo $row[2] ?></pre>
            <p class="uk-text-bold">价格：<?php echo $row[3] ?>￥</p>
            <p class="uk-text-bold">库存：<?php echo $row[4] ?></p>
            <div class="uk-margin-small">
                <div class="uk-button-group">
                    <button class="uk-button uk-button-primary">
                        加入购物车
                    </button>
                    <a href="buy.php?com_id=<?php echo $row[0] ?>" class="uk-link-muted">
                        <button class="uk-button uk-button-primary">
                            立即购买
                        </button>
                    </a>
                </div>
            </div>
        </div>
    </div>
</div>
<!-- 图片展示 -->
<div class="uk-position-relative uk-height-large" uk-slideshow="animation: fade" style="height: auto">
    <ul class="uk-slideshow-items">
        <li>
            <img src="<?php echo $row[6] ?>001.jpg"
                 alt=""
                 width="100px"
                 height="200px"
                 uk-cover>
        </li>
        <li>
            <img src="<?php echo $row[6] ?>002.jpg" alt="" uk-cover>
        </li>
        <li>
            <img src="<?php echo $row[6] ?>003.jpg" alt="" uk-cover>
        </li>
    </ul>

    <div class="uk-position-bottom-center uk-position-small">
        <ul class="uk-thumbnav">
            <li uk-slideshow-item="0">
                <a href="#">
                    <img src="<?php echo $row[6] ?>small_01.jpg"
                         width="100"
                         alt="">
                </a>
            </li>
            <li uk-slideshow-item="1">
                <a href="#">
                    <img src="<?php echo $row[6] ?>small_02.jpg"
                         width="100"
                         alt="">
                </a>
            </li>
            <li uk-slideshow-item="2">
                <a href="#">
                    <img src="<?php echo $row[6] ?>small_03.jpg"
                         width="100"
                         alt="">
                </a>
            </li>
        </ul>
    </div>

</div>

<?php include '../base/footer.php' ?>
